package com.atguigu.spring5.jdbctemplate.dao;


import com.atguigu.spring5.jdbctemplate.entity.Order;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class BookDaoImpl implements BookDao {

    @Autowired
    JdbcTemplate jdbcTemplate;
    String sql = "select * from template-order";


    @Override
    public void addOrder(Order order) {
        Object [] args = {order.getId(), order.getOrder_no()};
        String updateSql = "insert into orders values(?,?)";
        int update = jdbcTemplate.update(updateSql,args );
        System.out.println("更新了" + update + "条！");
    }
}
